  //<script type="text/javascript">
    function init_google_map_auto_search() {
      var input = document.getElementById('theAddress');
      var autocomplete = new google.maps.places.Autocomplete(input);
      autocomplete.setComponentRestrictions({ 'country': 'au' });
    }
  //</script>

  //<script type="text/javascript">

  function document_load(){
    // pop-up windows logic
         if (get_cookie('popped')=='' ){
           showMessageBox();
           document.cookie = "popped=yes;max-age=" + 60*60*24*7 +
                  "";
         }
    // pop-up windows logic

     zoyoe.map = new MapInfoCore(function(){},null,null,null);
     if(zoyoe.ElementExtension){
       zoyoe.ElementExtension.BuildExtensionElements();
     }

     init_google_map_auto_search();

     YUI().use("node",'io-form','event','io',function(Y){

     

         var search_option = Y.one("#match-option");
         zoyoe.InitZoyoe(false,Y);
         zoyoe.search = InitSearch(search_option,"/general",MarkValidate,MarkInvalidate);
         zoyoe.admin = InitAdmin(zoyoe);
         zoyoe.search.SetPreference('general',0);
         var searchInput = Y.one("#main-search-bar input");
         if (searchInput != null) {
           var tipMsg = "";
           var addressTipMsg = "Please enter your location or postcode";
           var searchInputNode = Y.Node.getDOMNode(searchInput);
           var generalTarget = Y.one("#match-option").all("a").item(0);
           var girlTarget = Y.one("#match-option").all("a").item(1);
           tipMsg = addressTipMsg;
           searchInputNode.value = tipMsg;
           searchInputNode.style.color = "grey";
           searchInput.on('focus', function(e){
             if (searchInputNode.value == tipMsg) {
               searchInputNode.value = "";
               searchInputNode.style.color = "black";
             }
           });
           searchInput.on('blur', function(e){
             if (searchInputNode.value == "") {
               searchInputNode.value = tipMsg;
               searchInputNode.style.color = "grey";
             }
           });
           generalTarget.on('click', function(e){
             tipMsg = addressTipMsg;
             if (searchInputNode.value == "") {
                 searchInputNode.value = tipMsg;
                 searchInputNode.style.color = "grey";
             }
           });
           girlTarget.on('click', function(e){
             tipMsg = addressTipMsg;
             if (searchInputNode.value == "") {
                 searchInputNode.value = tipMsg;
             }
             // update the filters
             nationalityDiv.className = "extension-combo-select";
             radiusDiv.className = "extension-drop-list";
             priceDiv.className = "extension-drop-list-disabled";
             ageDiv.className = "extension-drop-list";
           });
         }
      });

    }
     
    function setType(type) {
      YUI().use("node",function(Y){
         var links = Y.one("#service-type").all("a");
         var typeInput = Y.one("#service-type input");
         var index = 0;
         if (type == "All") {
           index = 0;
         } else if (type == "Brothel") {
           index = 1;
         } else if (type == "Escort") {
           index = 2;
         } else if (type == "Massage") {
           index = 3;
         }
         typeInput.set('value',type);
         links.set('className','filter-button');
         links.item(index).set('className','filter-button-select');
      });
    }

function get_cookie(Name) {
  var search = Name + "=" 
  var returnvalue = ""; 
  if (document.cookie.length > 0) { 
                offset = document.cookie.indexOf(search) 
                if (offset != -1) { 
                        offset += search.length 
                        end = document.cookie.indexOf(";", offset); 
                        if (end == -1) 
                        end = document.cookie.length; 
                        returnvalue=unescape(document.cookie.substring(offset, end)) 
                } 
  } 
  return returnvalue; 
}

function showMessageBox(){
  wWidth=350;
  pos=400;

  closeWindow();
  var bWidth=parseInt(document.documentElement.scrollWidth);
  var bHeight=parseInt(document.documentElement.scrollHeight);
  //if(isIe){
  //  setSelectState('hidden');
  //}
  var back=document.createElement("div");
  back.id="back";
  var styleStr="left:0px;position:absolute;top:0px;z-index:103;background:#666;width:"+bWidth+"px;height:"+bHeight+"px;opacity:0.80;";
  //styleStr+=(isIe)?"filter:alpha(opacity=40);":"opacity:0.40;";

  back.style.cssText=styleStr;
  document.body.appendChild(back);
  var mesW=document.createElement("div");
  mesW.id="mesWindow";
  mesW.className="mesWindow";
  //mesW.innerHTML="<iframe width=100% height=670 marginwidth=0 marginheight=0 scrolling=no src='http://192.168.1.154:8000/warningHome'>" 
  mesW.innerHTML="<iframe width=100% height=670 marginwidth=0 marginheight=0 scrolling=no src='http://auadult.com.au/warningHome'>" 
  + "</iframe>" 
  + "<div style='text-align:center;position:relative;top:-300px;right:155px'><a href='http://www.google.com.au/' style='z-index:200;color:red;font-size:30px;cursor:pointer;'>Leave</a><span>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</span>" 
  + "<a onclick='closeWindow();' style='z-index:200;color:red;font-size:30px;cursor:pointer;text-decoration:underline;'>Enter</a></div>"
  styleStr="margin:auto;position:relative;opacity:0.99";

  mesW.style.cssText=styleStr;
  document.body.appendChild(mesW);
}

function closeWindow(){
  if(document.getElementById('back')!=null){
    document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
  }
  if(document.getElementById('mesWindow')!=null){
    document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));
  }
  //if(isIe){
  //  setSelectState('');
  //}
}
